<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed');
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="row">

                            <form class="form-inline" action="{:U('index')}" style=" padding: 0px 5px; float:left" method="get">

                                <label class="inline">订单搜索</label>
                                <!--<input type="text" name="keyword" value="{$sh.keyword}" class="form-control">-->
                                <input type="hidden" name="c" value="{$Think.const.CONTROLLER_NAME}" class="form-control">
                                <input type="hidden" name="a" value="{$Think.const.ACTION_NAME}" class="form-control">
                                <input type="hidden" name="m" value="{$Think.const.MODULE_NAME}" class="form-control">
                                <label class="inline">订单编号</label>
                                <input type="text" name="ref" value="{$sh.ref}" class="form-control">
                                <label class="inline">订购人</label>
                                <input type="text" name="buyer_name" value="{$sh.buyer_name}" class="form-control">
                                <div class="form-group">
                                    <select name="channel_code">
                                        <option value="">请选择渠道</option>
                                    <volist name="channel_codelist" id="vvv">
                                        <option value="{$vvv.channel_code}" <if condition="$vvv.channel_code eq $sh['channel_code']">selected="selected" </if>>{$vvv.channel_code}</option>
                                    </volist>                                    
                                </select>
                                </div>
                                <div class="form-group">
                                    <select name="trade_pattern">
                                        <option value="">请选择贸易模式</option>
                                    <volist name="trade_patternlist" id="vvv">
                                        <option value="{$vvv.trade_pattern}" <if condition="$vvv.trade_pattern eq $sh['trade_pattern']">selected="selected" </if>>{$vvv.trade_pattern}</option>
                                    </volist>                                    
                                </select>
                                </div>
                                <div class="form-group">
                                    <select name="ebpCode">
                                        <option value="">请选择商家编号</option>
                                    <volist name="ebpCodelist" id="vvv">
                                        <option value="{$vvv.ebpcode}" <if condition="$vvv.ebpcode eq $sh['ebpCode']">selected="selected" </if>>{$vvv.ebpcode}</option>
                                    </volist>                                    
                                </select>
                                </div>
                                
                                <button type="submit" class="btn btn-purple btn-sm">
                                    <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                    Search
                                </button>
                            </form>
                        </div>
                       
                        <div class="space-4"></div>
                        <style>
                            .goodslist{font-size: 10px;}
                        </style>
                        <div class="row">
                            <form id="form" method="post" action="{:U('goodsBath')}">
                                <table class="table table-striped table-bordered table-hover goodslist" >
                                    <thead>
                                    <tr>
                                        <th class="center"><input class="check-all" type="checkbox" value=""></th>
                                        <th width="100px">订单编号</th>
                                        <th >订单渠道</th>
                                        <th>贸易模式</th>
                                        <th >订单日期</th>
                                        <th>订购人</th>
                                        <th>身份证</th>
                                        <th>总税额</th>
                                        <th>运费</th>
                                        <th>订单总额</th>
                                        <th>店铺编码</th>
                                        <th>创建时间</th>
                                        <th>状态</th>
                                        <th class="center" width="50px" >操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <style>
                                        .grouptd {
                                            position: relative;
                                        }

                                        .group {
                                            display: inline-block;
                                            width: 100%;
                                        }

                                        .groupselect {
                                            position: absolute;
                                            top: 0;
                                            left: 0;
                                            width: 100%;
                                            height: 100%;
                                            border: 0;
                                        }
                                    </style>
                                    <volist name="list" id="val">
                                        <tr>
                                            <td class="center">
                                               <input class="ids" type="checkbox" name="ids[]" value="{$val['id']}">
                                            </td>
                                            <td><a href="{:U('detail',array('ref'=>$val['ref']))}" target="_new">{$val['ref']}</a></td>
                                            <td>{$val['channel_code']}</td>
                                            <td>{$val['trade_pattern']}</td>
                                            <td>{$val['date_order']}</td>
                                            <td>{$val['buyer_name']}</td>
                                            <td>{$val['buyer_id_card']}</td>
                                            <td>{$val['total_import_taxes']}</td>
                                            <td>{$val['delivery_fee']}</td>
                                            <td>{$val['amount_total']}</td>
                                            <td>{$val['ebpcode']}</td>
                                            <td>{$val['create_time']}</td>
                                            <td>{:get_order_status($val['state'])}</td>
                                            
                                            <td class="center"><a href="{:U('edit')}&id={$val['id']}">修改</a>&nbsp;
                                               <a class="del" href="javascript:;"
                                                                                     val="{:U('del')}&ids={$val['id']}"
                                                                                     title="删除">删除</a>
                                            </td>
                                        </tr>
                                    </volist>
                                    
                                    </tbody>
                                </table>
                            
                            {$page}
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(function () {
        var goods_type_id = $('#goods_type').val();
        if(goods_type_id){
            $('#goods_type_id option').each(function(){
                  if( goods_type_id == $(this).attr('value') ) {
                      $(this).attr('selected' , true);
                      return false;
                  } 
               }); 
        }
         
      


        $(".check-all").click(function () {
            $(".ids").prop("checked", this.checked);
        });
        $(".ids").click(function () {
            var option = $(".ids");
            option.each(function (i) {
                if (!this.checked) {
                    $(".check-all").prop("checked", false);
                    return false;
                } else {
                    $(".check-all").prop("checked", true);
                }
            });
        });
        $("input[id^='submit']").click(function () {
            var optype=$(this).attr("optype");
            $('input[name="optype"]').val(optype);
            if($(".ids:checked").size()<1){
                bootbox.alert({
                    title:"请选择商品",
                    message:"商品未选中，请选择商品！"
                });
                return false;
            }
            if($('input[name="siteids[]"]:checked').size()<1){
                bootbox.alert({
                    title:"请选择站点",
                    message:"站点未选择，请选择站点（至少一个）！"
                });
                return false;
            }
//            if($('#storeids-select').val()==0){
//                bootbox.alert({
//                    title:"请选择商铺",
//                    message:"商铺未选择，请选择商铺！"
//                });
//                return false;
//            }
            bootbox.confirm({
                title: "系统提示",
                message: "确定要批量操作本页的数据吗？"+optype,
                callback: function (result) {
                    if (result) {
                        $("#form").submit();
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
        
        $(".del").click(function () {
            var url = $(this).attr('val');
            bootbox.confirm({
                title: "系统提示",
                message: "是否要删除该商品?",
                callback: function (result) {
                    if (result) {
                        window.location.href = url;
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
    })
</script>
</body>
</html>
